// const assert = require('assert')

// var sum = (a, b) => a + b

// assert.strictEqual(sum(1,2), 3, '内容不相等')
// assert.strictEqual(sum(NaN,NaN), NaN, 'NaN 内容不相等')
// assert.strictEqual(sum('1','2'), '12', 'string内容不相等')



let objArr =  [
  {
    id: 111
  },
  {
    id: 222
  },
  {
    id: 333
  },
]

var isIdEqual = function(array,id) {
  let index = -1
  for (let i=0;i<array.length;i++) {
    if (array[i].id == id) {
      index = i
      break
    }
  }
  return index
}

const index =  isIdEqual(objArr,3332)
console.log(index)